package cn.bigway.app.weavingdesigner.weaving;

import java.awt.FlowLayout;

import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public final class WdWeavingDoc extends JInternalFrame {

	private static final long serialVersionUID = -5460198280238816663L;
	private JScrollPane scrollPane;
	private WdDocPanel docPanel;
	private JPanel borderPanel;

	private WdWeavingDocInitData initData;

	public WdWeavingDoc(WdWeavingDocInitData initData) {
		super("", true, true, true, true);
		this.initData = initData;
		this.docPanel = new WdDocPanel(this);
		this.borderPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		this.borderPanel.add(this.docPanel);
		this.scrollPane = new JScrollPane(this.borderPanel);
		this.scrollPane.setAutoscrolls(true);
		getContentPane().add(this.scrollPane);
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	}

	public WdWeavingDocInitData getInitData() {
		return this.initData;
	}

	public void adjustLayout() {
		this.docPanel.doLayout();
		this.borderPanel.doLayout();
		this.scrollPane.doLayout();
	}
}
